home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 099 (1989-05-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 099 (1989-05-15)(Ossowski, Stefan)(DE)(PD).adf / PCQ / Include / StringLib.i < prev   
Text File  |  1989-03-31  |  2KB  |  56 lines

  1.  
  2.     { A select few string routines- the ones I needed for the compiler }
  3.  
  4. Function streq(s1, s2 : String): Boolean;
  5.     forward;
  6.  
  7. { returns true if the strings are equal, false otherwise.
  8.   Because I needed it for the compiler, this routine is
  9.   case insensitive.  }
  10.  
  11. Function strcmp(s1, s2 : String): Integer;
  12.     forward;
  13.  
  14. { returns 0 if the strings are equal, -1 if s1 is < s2, and 1 if
  15.   s1 > s2.  Again this is case insensitive.  }
  16.  
  17. Function strlen(s : String): Integer;
  18.     forward;
  19.  
  20. { returns the length of the string.  Remember that the string will
  21.   require that number plus one (for the zero termination byte) to
  22.   for storage }
  23.  
  24. Procedure strcpy(s1, s2 : string);
  25.     forward;
  26.  
  27. { copies s1 into s2.  Both of these must be allocated already, and the
  28.   routine does not do any length checking, so you'll have to use
  29.   AllocString() and strlen(), probably in reverse order }
  30.  
  31. Procedure strcat(s1, s2 : string);
  32.     forward;
  33.  
  34. { concatenates s2 on the end of s1.  s1 is assumed to be big enough }
  35.  
  36. Function AllocString(s : Integer): String;
  37.     forward;
  38.  
  39. { Allocates memory for a string of the given size.  This uses the
  40.   run time library's new() routine, so if you forget to free the
  41.   string you'll be OK }
  42.  
  43. Procedure FreeString(s : String);
  44.     forward;
  45.  
  46. { Frees the memory for the string }
  47.  
  48. Function raise(c : Char) : Char;
  49.     forward;
  50.  
  51. { if c is in [a..z] it returns the uppercase letter, otherwise it
  52.   just returns the same character.  OK, it's not really a string
  53.   function, but who's counting.  It's here because it's used internally
  54.   by streq and strcmp to make those functions case insensitive.  }
  55.  
  56.